package com.rs.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 命令类型
 *
 * @author zhouwz
 * @date 2020/7/19 15:25
 */
@AllArgsConstructor
public enum CommandEvent {
    /**
     * 命令类型
     */
    NORMAL(0, "正常"),
    SUSPEND(1, "暂停"),
    CONTINUE(2, "继续"),
    CANCEL(3, "取消"),
    ERROR(-1, "错误"),
    ;
    @Getter
    private final int code;
    @Getter
    private final String msg;

    public static CommandEvent getCommandEvent(int code) {
        for (CommandEvent item : CommandEvent.values()) {
            if (code == item.getCode()) {
                return item;
            }
        }
        return ERROR;
    }
}

